package com.Service.Impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.Dao.BaseDaoI;
import com.Entity.Category;
import com.Service.CategoryServiceI;

@Service("categoryService")
public class CategoryServiceImpl extends BaseServiceImpl<Category> implements
		CategoryServiceI {

	@Autowired
	private BaseDaoI<Category> categorydao;
	Category category = new Category();
	List<Category> categorylist = new ArrayList<Category>();

	@Override
	public Category findByCategoryName(String text) {
		// TODO Auto-generated method stub
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("categoryName", text);
		String hql = "from Category t where t.categoryName = :categoryName";
		categorylist = this.categorydao.find(hql, params);
		return categorylist.get(0);
	}

}
